//
//  AFHTTPSessionManager+ConfigSessionManager.h
//  AFNetworking
//
//  Created by yons on 27.9.20.
//

#import <AFNetworking/AFNetworking.h>

typedef NS_ENUM(NSInteger, HttpMethod) {
    HttpMethodGET = 0,
    HttpMethodPOST,
    HttpMethodDELETE,
    HttpMethodPUT
};

NS_ASSUME_NONNULL_BEGIN

@interface AFHTTPSessionManager (ConfigSessionManager)

/// 请求头参数,必须是key-value类型,只需设置一次
@property (nonatomic, strong) NSDictionary *headerParamsDic; // 请求头参数

/// 创建会话单例方法
+ (instancetype)shareSessionManager;

#pragma mark -----------------------🍺🍺🍺----------------------- 封装数据请求 -----------------------🍺🍺🍺-----------------------

/// 销毁单例
- (void)destorySessionManager;

/// 封装数据请求类
/// @param url url地址
/// @param method 请求方式
/// @param parameters 请求参数
/// @param success 成功回调
/// @param failure 失败回调
- (NSURLSessionDataTask *)requestWithURL:(NSString *)url
                              httpMethod:(HttpMethod)method
                              parameters:(nullable id)parameters
                                progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgress
                                 success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
                                 failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;

/// 封装图片上传请求类
/// @param url url地址
/// @param parameters 参数
/// @param imageArray 图片数组
/// @param name 指定名称
/// @param success 成功回调
/// @param failure 失败回调
- (NSURLSessionDataTask *)uploadImageWithURL:(NSString *)url
                                  parameters:(nullable id)parameters
                                  imageArray:(NSArray *)imageArray
                                        name:(NSString *)name
                                    progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgress
                                     success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success
                                     failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure;

@end

NS_ASSUME_NONNULL_END
